import React from 'react';
import {useNavigate, useLocation, useSearchParams} from 'react-router-dom';
import { NavBar } from 'antd-mobile'
import PropTypes from 'prop-types';
import './NavBarAgain.less'


const NavBarAgain = (props) => {
    // components下面的组件不是路由匹配的，因此没有动态加入那些路由钩子函数
    const navigate = useNavigate();
    const location = useLocation();
    const [sup] = useSearchParams();
    let title = props.title;
    const handleBack = () => {
        // 有点问题，在没有登录下
        navigate(-1);
    }

    return <>
        <div className='navbar-again-comp'>
            <NavBar onBack={handleBack}>{title}</NavBar>
        </div>
    </>

}

NavBarAgain.defaultProps = {
    title: '个人中心'
}

NavBarAgain.propTypes  = {
    title: PropTypes.string
}

export default NavBarAgain;